package com.free.md5parser.service;

import org.rocksdb.RocksDB;
import org.springframework.stereotype.Service;

@Service
public class RocksDBService {

    private final RocksDB rocksDB;

    public RocksDBService(RocksDB rocksDB) {
        this.rocksDB = rocksDB;
    }

    public void put(String key, String value) throws Exception {
        rocksDB.put(key.getBytes(), value.getBytes());
    }

    public String get(String key) throws Exception {
        byte[] value = rocksDB.get(key.getBytes());
        return value == null ? null : new String(value);
    }
}
